$(function(){ 	 	  
	  $('#staff').datagrid({
	      url: 'viewStaff',
	      method:'get',
	      rownumbers:true,
	     /* pagination:true,
	      pageSize:20,
	      pageList:[10,20,30],*/
	      fitColumns:true,
	      autoRowHeight:true,
	      singleSelect:true,
	      striped:true,
	      idField:'id',
	      columns:[[
	  			  {field:'id', title:'Staff Id', formatter:function(value, row){
	  				  return row.id;
	  			  }},
	  			  {field:'name', title:'Staff Name', formatter:function(value, row){
	  				  return row.name.firstName + '_' + row.name.lastName;
	  			  }},
	  	          {field:'address.address1', title:'Address', formatter:function(value, row){
	  	              return row.address.address1;
	  	          }},
	  	          {field:'email', title:'Email', formatter:function(value, row){
	  	              return row.email;
	  	          }},
	  	          {field:'opt1', title:' ', formatter:function(value, row){
	  	        	  return '<a href=\"goto_modifyStaff/' + row.id + '\">Edit Info</a>'; 
	  	          }}
	  	          ]]
	   });
}); 

function doSearch(){
    if(!$('#startDate').datebox('getValue') && !$('#endDate').datebox('getValue')){
		 $('#payments').datagrid('load',{
			 memberId: $('#customerId').val()
		 });
	 }else if(!$('#startDate').datebox('getValue')){
		 $('#payments').datagrid('load',{
		        endDate: $('#endDate').datebox('getValue'),
		        memberId: $('#customerId').val()
		 });
	 }else if(!$('#endDate').datebox('getValue')){
		 $('#payments').datagrid('load',{
		        startDate: $('#startDate').datebox('getValue'),
		        memberId: $('#customerId').val()
		 });
	 }else{
		 $('#payments').datagrid('load',{
		        startDate: $('#startDate').datebox('getValue'),
		        endDate: $('#endDate').datebox('getValue'),
		        memberId: $('#customerId').val()
		 });
	 } 
}